#pragma once

#include "condition.h"


namespace BAA
{

	class Action_Sneak:public Action
	{
	public:


		Action_Sneak(const string name, Vector2 * range):Action(name)
		{
			mRange.x = range->x;
			mRange.y = range->y;

			mAngerFactor = 0.2;
			mFearFactor = 0.2;
			mPhysicalExerciseFactor = 0.1;
		}


		virtual void PrepareConditions()
		{
			// nothing to do to run.
		}

		virtual float CalculateStateUtility()
		{
			AgentProperties * properties = mRoleParent->Self()->Properties();

			// this could be a condition rather then calculated during the utility
			float discovered = (*(properties->StateMap())["Discovered"] 
			if( discovered < 0) 
				return -1;

			
			// run when very scared, or angry, or really needing exercise

			return MathHelper.clamp(&mRange,
				   abs(mAngerFactor - properties->mAnger->GetValue()) +
				   abs(mFearFactor  - properties->mFear->GetValue())  +
				   abs(mPhysicalExerciseFactor - properties->mPhysicalExercise->Value()) +
				   discovered);
				

			

		}






		~Action_Sneak()
		{

		}

	protected:
		// any members

		Vector2 mRange;

		float mAngerFactor;
		float mFearFactor;
		float mPhysicalExerciseFactor;
	};// end class
}// end namespace
